﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using StudentMgmt.IDAL;
using StudentMgmt.Model;
using StudentMgmt.Model.DataContext;

namespace StudentMgmt.SQLServerDAL
{
   public class ChangeConfig : IChange_Config
    {
        public ChangeConfig() { }
        public IList< Change_ConfigInfo> GetChangeConfig()
        {
            StudentMgmtDataContext db = new StudentMgmtDataContext();
            var temp = from m in db.ChangeConfig
                            select m;
            return temp.ToList();
        }
       public   Change_ConfigInfo GetChangeConfigByChangeCode(string changeCode)
        {
            StudentMgmtDataContext db = new StudentMgmtDataContext();
            if (changeCode != null)
            { 
                var changeConfig = db.ChangeConfig.Single(s=> s.Change_Code==changeCode);
                return changeConfig;
            }   
            else
            {
                return null;
            }     
        }
    }
}
